package com.xd.spring.liteflow.component;

import com.yomahub.liteflow.core.NodeComponent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

@Component("e")
@Slf4j
public class ECmp extends NodeComponent {
    @Override
    public void process() throws Exception {
        String name = Thread.currentThread().getName();
        StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
        StackTraceElement stackTraceElement = stackTraceElements[1];
        String className = stackTraceElement.getClassName();
        String methodName = stackTraceElement.getMethodName();
        int lineNumber = stackTraceElement.getLineNumber();
        log.info("{} {} {} {} {} begin", name, className, methodName, lineNumber, System.currentTimeMillis());
        TimeUnit.SECONDS.sleep(5);
        log.info("{} {} {} {} {} end", name, className, methodName, lineNumber, System.currentTimeMillis());
    }
}
